package org.inspursc.s0517.health.common.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.inspursc.s0517.health.common.dao.SysLogDao;
import org.inspursc.s0517.health.common.entity.SysLog;
import org.inspursc.s0517.health.common.service.SysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

/**
 * @author yuchu
 */
@Service
@Slf4j
public class SysLogServiceImpl implements SysLogService {

    @Autowired
    private SysLogDao logDao;

    @Override
    public SysLog save(SysLog log) {
        return logDao.save(log);
    }

    @Override
    public SysLog findOne(Integer id) {
        return logDao.getOne(id);
    }

    @Override
    public boolean deleteById(Integer id) {
        try{
            logDao.deleteById(id);
            return true;
        }catch (Exception e){
            log.error(e.getMessage());
            return false;
        }
    }

    @Override
    public Page<SysLog> findAll(Pageable pageable) {
        return logDao.findAll(pageable);
    }
}
